import Book.BookList;
import User.AdminUser;
import User.User;
import User.NormalUser;

import java.util.Scanner;

public class BookTest {

    public static User login() {

        Scanner scanner = new Scanner(System.in);

        System.out.println("输入你的姓名");

        String name = scanner.nextLine();

        System.out.println("输入你的身份 1.管理员 2.普通用户");

        int choice = scanner.nextInt();

        System.out.println("欢迎" + name + "进入图书管理系统");


        if (choice == 1) {
            return new AdminUser(name);
        } else if (choice == 2){
            return new NormalUser(name);
        } else {
            System.out.println("身份错误");
            return null;
        }

    }

    public static void main(String[] args) {

        BookList bookList = new BookList();

        User user = login();

        boolean flag = true;

        while (flag) {
            int choice = user.menu();
            user.getOperation(choice).operation(bookList);
        }
    }

}
